package com.edu.config;

import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @作者 five-five
 * @创建时间 2021/1/19
 */
@Configuration
public class RestTemplateConfiguration {
    /**
     * 通过 Eureka 来消费接口
     * @LoadBalanced 这个注解会自动构造 LoadBalancerClient 接口的实现类并注册到 Spring 容器中
     * @return
     */
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
